<template>
  <div>
  </div>
</template>
<script>
export default {
  name: 'wel',
  data() {
    return {}
  },
  created() {
    console.log('indexw', this.$route)
    let self = this;
    let query = Object.assign({}, self.$route.query);
    if (query.tokenKey != null && query.tokenKey != '') {
      let tokenKey = query.tokenKey;
      let loginForm = {
        tokenKey: tokenKey,
        oc: true,
      };
      self.$store.dispatch("LoginByToken", loginForm).then((res) => {
        let tokenKeyInfo = res.data.info;
        let param = JSON.parse(tokenKeyInfo);
        if (param.offerId != null && param.offerId != '') {
          self.$store.commit('SET_OFFER', param.offerId);
        }
        window.sessionStorage.setItem("initPageInfo", tokenKeyInfo);
        if (param.r == null || param.r == '') {
          self.$router.push({path: '/welrel/index', query: {path: query.path, query: query.query}});
        } else {
          self.$router.push({path: param.r});
        }
      }).catch(() => {
        query.tokenKey = null;
        self.$router.push({path: '/login', query: query});
      });
    } else {
      self.$router.push({path: '/welrel/index', query: query});
    }
  },
  methods: {}
}
</script>
<style lang="scss">
</style>
